package com.ruoyi.system.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.dto.LoginDTO;
import com.ruoyi.system.service.LoginService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("app/api")
@Slf4j
@CrossOrigin
@Api(tags = "app用户模块")
public class LoginController {
    @Autowired
    private LoginService loginService;

    /**
     *
     * @param loginDTO
     * @return
     */
    @ApiOperation(value = "用户登录接口")
    @PostMapping("/login")
    public AjaxResult login(@RequestBody LoginDTO loginDTO){
        String token= loginService.login(loginDTO.getUserName(),loginDTO.getPassword(),loginDTO.getAgreed());
        return AjaxResult.success("操作成功",token);
    }

}
